package razor.blade;

import javafx.scene.*;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.geometry.*;
import tee.binding.*;
import javafx.application.*;
import javafx.geometry.*;
import javafx.scene.paint.*;
import javafx.stage.*;
import javafx.scene.text.*;
import javafx.scene.image.*;
import javafx.scene.shape.*;
import razor.blade.*;
import javafx.beans.binding.*;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.stage.*;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.scene.image.*;
import javafx.scene.input.*;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.geometry.*;
import tee.binding.*;
import javafx.scene.control.*;
import javafx.collections.*;
import java.util.*;

class DataGridRow {
}

class SubjectField {
}

class FromField {
}

class DateField {
}

public class DataGrid {
    private Numeric width;
    private Numeric height;
    private Numeric x;
    private Numeric y;
    private Group root;
    public Node node() {
        return root;
    }
    public DataGrid() {
        root = new Group();
        x = new Numeric().value(0);
        y = new Numeric().value(0);
        width = new Numeric().value(200);
        height = new Numeric().value(100);


        Rectangle r = new Rectangle();
        r.xProperty().bind(new Tee<Double>(x));
        r.yProperty().bind(new Tee<Double>(y));
        r.widthProperty().bind(new Tee<Double>(width));
        r.heightProperty().bind(new Tee<Double>(height));
        r.setFill(Color.web("#ff000033"));
        root.getChildren().add(r);

        TableView<DataGridRow> tableView = new TableView<DataGridRow>();
        //List<DataGridRow>rows=new List<DataGridRow>();
        //ObservableList<DataGridRow> rows = getTeamMembers();
        //tableView.setItems(rows);
        tableView.translateXProperty().bind(new Tee<Double>(x));
        tableView.translateYProperty().bind(new Tee<Double>(y));
        tableView.prefWidthProperty().bind(new Tee<Double>(width));
        tableView.prefHeightProperty().bind(new Tee<Double>(height));
        tableView.setTableMenuButtonVisible(true);
        //tableView.heightProperty().bind(new Tee<Double>(height));
        TableColumn<DataGridRow, SubjectField> subj = new TableColumn<DataGridRow, SubjectField>("Subject");
        TableColumn<DataGridRow, FromField> fr = new TableColumn<DataGridRow, FromField>("From");
        TableColumn<DataGridRow, DateField> dt = new TableColumn<DataGridRow, DateField>("Date");
        tableView.getColumns().add(subj);
        tableView.getColumns().add(fr);
        tableView.getColumns().add(dt);
        
        ObservableList<DataGridRow> rows = FXCollections.observableArrayList();
        for (int i = 0; i < 10; i++) {
            DataGridRow m = new DataGridRow();
            rows.add(m);
        }
        tableView.setItems(rows);

        root.getChildren().add(tableView);
    }
    public DataGrid x(double it) {
        x.value(it);
        return this;
    }
    public DataGrid x(int it) {
        x.value(it);
        return this;
    }
    public Numeric x() {
        return x;
    }
    public DataGrid x(It<Double> it) {
        x.bind(it);
        return this;
    }
    public DataGrid y(double it) {
        y.value(it);
        return this;
    }
    public DataGrid y(int it) {
        y.value(it);
        return this;
    }
    public Numeric y() {
        return y;
    }
    public DataGrid y(It<Double> it) {
        y.bind(it);
        return this;
    }
    public DataGrid width(double it) {
        width.value(it);
        return this;
    }
    public DataGrid width(int it) {
        width.value(it);
        return this;
    }
    public Numeric width() {
        return width;
    }
    public DataGrid width(It<Double> it) {
        width.bind(it);
        return this;
    }
    public DataGrid height(double it) {
        height.value(it);
        return this;
    }
    public DataGrid height(int it) {
        height.value(it);
        return this;
    }
    public Numeric height() {
        return height;
    }
    public DataGrid height(It<Double> it) {
        height.bind(it);
        return this;
    }
}
